home *** CD-ROM | disk | FTP | other *** search
/ Micromanía: 150 Juegos 2010 / 150Juegos_16.iso / Shareware / Shape Smash / shape-smash.swf / scripts / Code / WINDOWS / _wl522.as < prev   
Encoding:
Text File  |  2010-05-14  |  19.3 KB  |  476 lines

  1. package Code.WINDOWS
  2. {
  3.    import Code.FIELD._dq803;
  4.    import Code.FIELD.helpers.TShapeType;
  5.    import Code.LIB.SOUND._bu111;
  6.    import Code.LIB._be548;
  7.    import Code.LIB._cg33;
  8.    import Code.LIB._ct751;
  9.    import Code.LIB._gt710;
  10.    import Code.LIB._my111;
  11.    import Code.LIB._oo505;
  12.    import Code.LIB._rs402;
  13.    import Code.LIB._sb428;
  14.    import Code.LIB._se17;
  15.    import Code.LIB._tk11;
  16.    import Code.LIB._vx23;
  17.    import Code.LIB._wy567;
  18.    import Code.LIB.animators._aj302;
  19.    import Code.LIB.animators._do643;
  20.    import Code.LIB.animators._lv705;
  21.    import Code.LIB.animators._wr378;
  22.    import Code.OPTIONS.LEVELS;
  23.    import Code.OPTIONS._gs337;
  24.    import Code.WINDOWS.DIALOGS._fl44;
  25.    import Code.WINDOWS.SHOWS._st232;
  26.    import Code._fi197;
  27.    import flash.display.Sprite;
  28.    import flash.events.Event;
  29.    import flash.events.MouseEvent;
  30.    import flash.geom.Point;
  31.    import flash.net.URLRequest;
  32.    import flash.net.navigateToURL;
  33.    import flash.utils.getTimer;
  34.    import mochi.as3.MochiScores;
  35.    
  36.    public class _wl522 extends _gt710
  37.    {
  38.       public static const stShow:int = 0;
  39.       
  40.       public static const stLevel:int = 3;
  41.       
  42.       public static const stPlay:int = 4;
  43.       
  44.       public static const stComplete:int = 5;
  45.       
  46.       public static const stCompleteAllRoundz:int = 6;
  47.       
  48.       public static const stCompleteAllSquarez:int = 7;
  49.       
  50.       public static const stLoose:int = 8;
  51.       
  52.       public static const stCompleteAllLevels:int = 9;
  53.       
  54.       public static const stInvisible:int = 10;
  55.       
  56.       public static const stMenuConfirm:int = 11;
  57.       
  58.       public static const stPaused:int = 12;
  59.       
  60.       private static const TWCompleteParams:Array = [[_fi197._ww533,8286134,580,400,true,40,40,null,true],[_fi197._pm137,"Great, level completed!",_gs337.TColors,39,_my111.SmallText,220,60,null,true],[_fi197._xy367,"level score:",_gs337.cWhite,35,_my111.SmallText,50,120,"levelScore",true],[_fi197._xy367,"total score:",_gs337.cWhite,35,_my111.SmallText,50,160,"totalScore",true],[_fi197._tr788,"submit score",0,180,50,19,_gs337.cWhite,"submit_score",275,130,null,true],[_fi197._tr788,"next level",2,180,60,20,_gs337.cWhite,"next_level",55,270,null,true],[_fi197._pc92,"more games",0,180,60,18,_gs337.cWhite,"more_games",55,340,null,true]];
  61.       
  62.       private static const TWCompleteAllRoundzParams:Array = [[_fi197._ww533,_gs337.cGellGreen,580,400,true,40,40,null,true],[_fi197._pm137,"Great, you have completed all Roundz levels!\n Get ready to play in Squarez mode!",_gs337.TColors,40,_my111.SmallText,100,60,null,true],[_fi197._xy367,"level score:",_gs337.cWhite,35,_my111.SmallText,120,170,"levelScore",true],[_fi197._xy367,"total score:",_gs337.cWhite,35,_my111.SmallText,120,230,"totalScore",true],[_fi197._tr788,"next level",2,200,60,20,_gs337.cWhite,"next_level",245,310,null,true]];
  63.       
  64.       private static const TWCompleteAllSquarezParams:Array = [[_fi197._ww533,_gs337.cGellGreen,580,400,true,40,40,null,true],[_fi197._pm137,"Great, you have completed all Squarez levels!\n Get ready to play in Roundz mode!",_gs337.TColors,40,_my111.SmallText,100,60,null,true],[_fi197._xy367,"level score:",_gs337.cWhite,35,_my111.SmallText,120,170,"levelScore",true],[_fi197._xy367,"total score:",_gs337.cWhite,35,_my111.SmallText,120,230,"totalScore",true],[_fi197._tr788,"next level",2,200,60,20,_gs337.cWhite,"next_level",245,310,null,true]];
  65.       
  66.       private static const TWLevelFailed:Array = [[_fi197._ww533,_gs337.cGellPink,440,340,true,0,0,null,true],[_fi197._xy367,"level failed \n try again!",_gs337.cWhite,40,null,135,50,null,true],[_fi197._tr788,"play again",0,220,60,17,_gs337.cWhite,"play_again",100,160,null,true],[_fi197._pc92,"more games",0,220,60,20,_gs337.cWhite,"more_games",100,240,null,true]];
  67.       
  68.       private static const TWCompleteAllParams:Array = [[_fi197._ww533,8286134,580,400,true,30,20,null,true],[_fi197._xy367,"       Congratulations!\nYou have completed all levels!!!",_gs337.cWhite,34,_my111.SmallText,200,35,null,true],[_fi197._xy367,"level score:",_gs337.cWhite,35,_my111.SmallText,120,140,"levelScore",true],[_fi197._xy367,"total score:",_gs337.cWhite,35,_my111.SmallText,120,185,"totalScore",true],[_fi197._tr788,"play again",2,220,60,20,_gs337.cWhite,"play_again",220,230,null,true],[_fi197._pc92,"submit score",0,200,60,19,_gs337.cWhite,"submit_score",340,310,null,true],[_fi197._pc92,"more games",0,200,60,19,_gs337.cWhite,"more_games",110,310,null,true]];
  69.       
  70.       public var pause:_ct751;
  71.       
  72.       private var dMenu:_fl44;
  73.       
  74.       private var msgs:Array;
  75.       
  76.       public var iLevelLabel:_wy567;
  77.       
  78.       private var iField:_dq803;
  79.       
  80.       private var iScoreBut:_ct751;
  81.       
  82.       public var menu:_ct751;
  83.       
  84.       private var allLevels:Boolean = false;
  85.       
  86.       private var stateStack:int;
  87.       
  88.       private var iMsgLabel:_wy567;
  89.       
  90.       private var submitDialog:_fl44;
  91.       
  92.       private var score:_sb428;
  93.       
  94.       private var showWindow:_st232;
  95.       
  96.       private var iState:int;
  97.       
  98.       public var iPauseLabel:_wy567;
  99.       
  100.       public function _wl522()
  101.       {
  102.          var _loc1_:Array = null;
  103.          var _loc2_:Array = null;
  104.          var _loc3_:_oo505 = null;
  105.          allLevels = false;
  106.          _loc1_ = [[_fi197._pc92,_gs337.iLanguage.strMenu,_gs337.cAqua,80,35,17,_gs337.cWhite,545,430,"menu",true],[_fi197._tr788,_gs337.iLanguage.strPause,_gs337.cAqua,80,35,17,_gs337.cWhite,545,380,"pause",true],[_fi197._xy367,(_vx23._pm756 + 1) / _vx23._qq496,_gs337.cWhite,20,null,680,50,null,false],[_fi197._xy367,_gs337.iLanguage.strPaused,_gs337.cWhite,44,_my111.BigText,40,150,"iPauseLabel",false]];
  107.          _loc2_ = TWCompleteParams[4];
  108.          _loc2_[_loc2_.length - 1] = !_cg33._dn742;
  109.          _loc2_ = TWCompleteAllParams[5];
  110.          _loc2_[_loc2_.length - 1] = !_cg33._dn742;
  111.          super(_loc1_);
  112.          score = new _sb428(20,_gs337.cWhite,"level score\n");
  113.          score.alpha = 1;
  114.          score._yc70 = 0;
  115.          score.visible = false;
  116.          score._vg471 = 10;
  117.          score._vq458 = 447;
  118.          addChild(score);
  119.          _loc3_ = _tk11._ln87(new _gs337.TFieldBG() as Sprite);
  120.          addChildAt(_loc3_,0);
  121.          _pp317();
  122.       }
  123.       
  124.       public function _pp317() : void
  125.       {
  126.          this.iMsgLabel = new _wy567(40,_gs337.cAqua,_my111.Bevel);
  127.          this.addChild(this.iMsgLabel);
  128.          this.iMsgLabel.mouseEnabled = false;
  129.          _rs402.prStage.addEventListener(Event.DEACTIVATE,_nj225);
  130.       }
  131.       
  132.       override public function _ba289(param1:MouseEvent) : void
  133.       {
  134.          var _loc2_:String = null;
  135.          var _loc3_:* = null;
  136.          if(Boolean(submitDialog) && (param1.target == submitDialog.iOk._en365 || param1.target == submitDialog.iCancel._en365))
  137.          {
  138.             switch(param1.target)
  139.             {
  140.                case submitDialog.iOk._en365:
  141.                   _loc2_ = int(_rs402.prStage.stageWidth) + "x" + int(_rs402.prStage.stageHeight);
  142.                   MochiScores._rh570({
  143.                      "boardID":"6c4dfd82c9e388bd",
  144.                      "score":_vx23._om626,
  145.                      "res":_loc2_,
  146.                      "onError":_mf701
  147.                   });
  148.                   _cg33._dn742 = true;
  149.                   iScoreBut.visible = false;
  150.                   break;
  151.                case submitDialog.iCancel._en365:
  152.             }
  153.             removeChild(submitDialog);
  154.             submitDialog._dx150();
  155.             submitDialog = null;
  156.             return;
  157.          }
  158.          switch(iState)
  159.          {
  160.             case stPlay:
  161.                if(param1.target == pause._en365)
  162.                {
  163.                   iField.pause = !iField.pause;
  164.                   iPauseLabel.visible = iField.pause;
  165.                }
  166.                break;
  167.             case stLoose:
  168.                if(param1.target.parent is _ct751 && _ct751(param1.target.parent).ID == "play_again")
  169.                {
  170.                   (parent as _se17).menuItem = _gs337.miGame;
  171.                   hide();
  172.                   State = stInvisible;
  173.                }
  174.                break;
  175.             case stComplete:
  176.                if(param1.target.parent is _ct751 && _ct751(param1.target.parent).ID == "next_level")
  177.                {
  178.                   (parent as _se17).menuItem = _gs337.miGame;
  179.                   hide();
  180.                   State = stInvisible;
  181.                }
  182.                break;
  183.             case stCompleteAllRoundz:
  184.                if(param1.target.parent is _ct751 && _ct751(param1.target.parent).ID == "next_level")
  185.                {
  186.                   (parent as _se17).menuItem = _gs337.miGame;
  187.                   hide();
  188.                   State = stInvisible;
  189.                }
  190.                break;
  191.             case stCompleteAllSquarez:
  192.                if(param1.target.parent is _ct751 && _ct751(param1.target.parent).ID == "next_level")
  193.                {
  194.                   (parent as _se17).menuItem = _gs337.miGame;
  195.                   hide();
  196.                   State = stInvisible;
  197.                }
  198.                break;
  199.             case stMenuConfirm:
  200.                if(param1.target == dMenu._dg142._en365)
  201.                {
  202.                   hide();
  203.                }
  204.                else if(param1.target == dMenu._ta621._en365)
  205.                {
  206.                   dMenu._dx150();
  207.                   removeChild(dMenu);
  208.                   dMenu = null;
  209.                   iState = stateStack;
  210.                }
  211.                break;
  212.             case stCompleteAllLevels:
  213.                if(param1.target.parent is _ct751 && _ct751(param1.target.parent).ID == "play_again")
  214.                {
  215.                   (parent as _se17).menuItem = _gs337.miGame;
  216.                   hide();
  217.                   State = stInvisible;
  218.                }
  219.          }
  220.          if(param1.target == menu._en365 && iState != stMenuConfirm)
  221.          {
  222.             State = stMenuConfirm;
  223.          }
  224.          if(param1.target.parent is _ct751 && _ct751(param1.target.parent).ID == "more_games")
  225.          {
  226.             _loc3_ = "http://www.bibagames.com/";
  227.             if(iState == stComplete)
  228.             {
  229.                _loc3_ += "?r=shape_smash_complete";
  230.             }
  231.             else if(iState == stLoose)
  232.             {
  233.                _loc3_ += "?r=shape_smash_brgame";
  234.             }
  235.             else if(iState == stCompleteAllLevels)
  236.             {
  237.                _loc3_ += "?r=shape_smash_endgame";
  238.             }
  239.             navigateToURL(new URLRequest(_loc3_),"_blank");
  240.          }
  241.          if(param1.target.parent is _ct751 && _ct751(param1.target.parent).ID == "submit_score")
  242.          {
  243.             submitDialog = new _fl44("     You can submit\n     score only once.\n      Are you sure?");
  244.             addChild(submitDialog);
  245.             submitDialog._xe768(150,100);
  246.             iScoreBut = param1.target.parent as _ct751;
  247.          }
  248.       }
  249.       
  250.       override public function _dx150() : void
  251.       {
  252.          super._dx150();
  253.       }
  254.       
  255.       public function _nj225(param1:Event) : void
  256.       {
  257.          if(iField)
  258.          {
  259.             iField.pause = true;
  260.             iPauseLabel.visible = iField.pause;
  261.          }
  262.       }
  263.       
  264.       override public function onEnterFrame(param1:Event) : void
  265.       {
  266.          var _loc2_:int = 0;
  267.          super.onEnterFrame(param1);
  268.          _loc2_ = getTimer();
  269.          switch(this.iState)
  270.          {
  271.             case stShow:
  272.                if(!this._fl746 && this._hy116)
  273.                {
  274.                   this.State = stLevel;
  275.                }
  276.                break;
  277.             case stLevel:
  278.                if(this.iMsgLabel.alpha < 0.99)
  279.                {
  280.                   this.iMsgLabel.alpha += 0.07;
  281.                }
  282.                if(_loc2_ - this.iITimer > 2500)
  283.                {
  284.                   this.State = stPlay;
  285.                }
  286.                break;
  287.             case stPlay:
  288.                if(iField.alpha < 1)
  289.                {
  290.                   iField.alpha += 1 / 50;
  291.                }
  292.                if(score._yc70 != iField.score)
  293.                {
  294.                   score._yc70 = iField.score;
  295.                }
  296.                if(iField.State == _dq803.stWin)
  297.                {
  298.                   State = stComplete;
  299.                }
  300.                else if(iField.State == _dq803.stGameOver)
  301.                {
  302.                   State = stLoose;
  303.                }
  304.                break;
  305.             case stComplete:
  306.             case stLoose:
  307.          }
  308.       }
  309.       
  310.       public function _mf701(param1:Object = null) : void
  311.       {
  312.          _cg33._dn742 = false;
  313.          trace("ON ERROR!");
  314.       }
  315.       
  316.       private function set State(param1:int) : void
  317.       {
  318.          var _loc2_:Array = null;
  319.          var _loc3_:String = null;
  320.          var _loc4_:_wr378 = null;
  321.          var _loc5_:int = 0;
  322.          var _loc6_:Object = null;
  323.          var _loc7_:_tc365 = null;
  324.          var _loc8_:_do643 = null;
  325.          var _loc9_:_be548 = null;
  326.          stateStack = iState;
  327.          this.iState = param1;
  328.          switch(this.iState)
  329.          {
  330.             case stShow:
  331.                break;
  332.             case stLevel:
  333.                if(_vx23._xh67)
  334.                {
  335.                   _vx23._ew523();
  336.                }
  337.                if(_vx23._un44 == TShapeType.CIRCLE && _vx23._xp514)
  338.                {
  339.                   _vx23._un44 = TShapeType.POLY;
  340.                }
  341.                else if(_vx23._un44 == TShapeType.POLY && _vx23._bu14)
  342.                {
  343.                   _vx23._un44 = TShapeType.CIRCLE;
  344.                }
  345.                _loc2_ = TWCompleteParams[4];
  346.                _loc2_[_loc2_.length - 1] = !_cg33._dn742;
  347.                _loc2_ = TWCompleteAllParams[5];
  348.                _loc2_[_loc2_.length - 1] = !_cg33._dn742;
  349.                this.iMsgLabel.Color = _gs337.cWhite;
  350.                this.iMsgLabel._gg765 = 60;
  351.                _loc3_ = "";
  352.                _loc3_ += "         " + (_vx23._un44 == TShapeType.CIRCLE ? _gs337.iLanguage.strRoundz : _gs337.iLanguage.strSquarez) + "\n";
  353.                _loc3_ += "         " + _gs337.iLanguage.strLevel + " # " + (_vx23._pm756 + 1).toString() + "/" + _vx23._qq496;
  354.                this.iMsgLabel.Text = _loc3_;
  355.                this.iMsgLabel._xe768((500 - this.iMsgLabel.width) / 2,(600 - this.iMsgLabel.height) / 2);
  356.                this.iMsgLabel.alpha = 0;
  357.                this.iITimer = getTimer();
  358.                break;
  359.             case stPlay:
  360.                _loc4_ = new _wr378(iMsgLabel);
  361.                _loc4_.animate({"toPoint":new Point(iMsgLabel._vq458 + 1500,iMsgLabel._vg471)});
  362.                _wk598(_loc4_);
  363.                menu.visible = true;
  364.                score.visible = true;
  365.                _loc5_ = _vx23._pm756;
  366.                _loc6_ = _vx23._un44 == TShapeType.CIRCLE ? LEVELS.RoundzLevels[_loc5_] : LEVELS.BlockzLevels[_loc5_];
  367.                this.iField = new _dq803(_loc6_,_vx23._un44,_loc5_ + 1);
  368.                this.addChildAt(iField,1);
  369.                iField.alpha = 0;
  370.                break;
  371.             case stComplete:
  372.                _vx23._wt252();
  373.                _vx23._sh498(iField.score);
  374.                if(_vx23._xh67)
  375.                {
  376.                   State = stCompleteAllLevels;
  377.                   return;
  378.                }
  379.                if(_vx23._un44 == TShapeType.CIRCLE)
  380.                {
  381.                   if(_vx23._xp514)
  382.                   {
  383.                      _vx23._un44 = TShapeType.POLY;
  384.                      State = stCompleteAllRoundz;
  385.                      return;
  386.                   }
  387.                }
  388.                else if(_vx23._bu14)
  389.                {
  390.                   _vx23._un44 = TShapeType.CIRCLE;
  391.                   State = stCompleteAllSquarez;
  392.                   return;
  393.                }
  394.                showWindow = new _st232(TWCompleteParams);
  395.                _loc7_ = new _tc365(true);
  396.                showWindow.addChild(_loc7_);
  397.                _loc7_._xe768(220,240);
  398.                _loc7_.alpha = 1;
  399.                _loc7_.isShowing = false;
  400.                showWindow._ot632();
  401.                showWindow._aw141(showWindow.getChildAt(0));
  402.                showWindow.levelScore.Text = "Level score:       " + iField.score;
  403.                showWindow.totalScore.Text = "Total score:       " + _vx23._om626;
  404.                _loc8_ = new _lv705(showWindow,_lv705.HORIZONTAL);
  405.                showWindow.startAnimation(_loc8_);
  406.                addChild(showWindow);
  407.                showWindow.alpha = 0.4;
  408.                _bu111._wu209("maximize");
  409.                break;
  410.             case stCompleteAllRoundz:
  411.                showWindow = new _st232(TWCompleteAllRoundzParams);
  412.                showWindow._ot632();
  413.                showWindow._aw141(showWindow.getChildAt(0));
  414.                showWindow.levelScore.Text = "Level score:       " + iField.score;
  415.                showWindow.totalScore.Text = "Total score:       " + _vx23._om626;
  416.                _loc8_ = new _lv705(showWindow,_lv705.HORIZONTAL);
  417.                showWindow.startAnimation(_loc8_);
  418.                addChild(showWindow);
  419.                showWindow.alpha = 0.4;
  420.                _bu111._wu209("maximize");
  421.                break;
  422.             case stCompleteAllSquarez:
  423.                showWindow = new _st232(TWCompleteAllSquarezParams);
  424.                showWindow._ot632();
  425.                showWindow._aw141(showWindow.getChildAt(0));
  426.                showWindow.levelScore.Text = "Level score:       " + iField.score;
  427.                showWindow.totalScore.Text = "Total score:       " + _vx23._om626;
  428.                _loc8_ = new _lv705(showWindow,_lv705.HORIZONTAL);
  429.                showWindow.startAnimation(_loc8_);
  430.                addChild(showWindow);
  431.                showWindow.alpha = 0.4;
  432.                _bu111._wu209("maximize");
  433.                break;
  434.             case stLoose:
  435.                showWindow = new _st232(TWLevelFailed);
  436.                showWindow._ot632();
  437.                showWindow._aw141(showWindow.getChildAt(0));
  438.                _loc9_ = new _be548();
  439.                _loc9_.addChild(showWindow);
  440.                showWindow._xe768(-220,-135);
  441.                _loc9_._xe768(310,195);
  442.                _loc8_ = new _aj302(_loc9_,_aj302.ROTATE_AND_SHOW);
  443.                showWindow.startAnimation(_loc8_);
  444.                addChild(_loc9_);
  445.                _bu111._wu209("maximize");
  446.                break;
  447.             case stMenuConfirm:
  448.                if(iField)
  449.                {
  450.                   iField.pause = true;
  451.                   iPauseLabel.visible = iField.pause;
  452.                }
  453.                _bu111._wu209("maximize");
  454.                dMenu = new _fl44("    exit to menu?");
  455.                dMenu._xe768(60,30);
  456.                addChild(dMenu);
  457.                break;
  458.             case stPaused:
  459.                _bu111._wu209("maximize");
  460.                break;
  461.             case stCompleteAllLevels:
  462.                showWindow = new _st232(TWCompleteAllParams);
  463.                showWindow._ot632();
  464.                showWindow._aw141(showWindow.getChildAt(0));
  465.                showWindow.levelScore.Text = "Level score:       " + iField.score;
  466.                showWindow.totalScore.Text = "Total score:       " + _vx23._om626;
  467.                _loc8_ = new _lv705(showWindow,_lv705.HORIZONTAL);
  468.                showWindow.startAnimation(_loc8_);
  469.                addChild(showWindow);
  470.                _bu111._wu209("maximize");
  471.          }
  472.       }
  473.    }
  474. }
  475.  
  476.